package com.joplus.housekeeper.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.joplus.housekeeper.R;

/**
 * Created by ccm on 2016/9/30 18:00
 */
public class InterestAdapter extends BaseAdapter {
    private Context mContext;
    private int[] imageN;
    private String[] text;

    public InterestAdapter(Context context, int[] imageN, String[] text) {
        this.mContext = context;
        this.imageN = imageN;
        this.text = text;
    }

    @Override
    public int getCount() {
        return 9;
    }

    @Override
    public Object getItem(int position) {
        return position;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView = LayoutInflater.from(mContext).inflate(R.layout.item_interest, null);
        ImageView iv = (ImageView) convertView.findViewById(R.id.interest_iv);
        TextView tv = (TextView) convertView.findViewById(R.id.interest_tv);
        iv.setImageResource(imageN[position]);
        tv.setText(text[position]);
        return convertView;
    }
}
